Infinite queries topic

Paged data in the same four styles: context.infiniteQuery, QueryMixin.watchInfiniteQuery, InfiniteQueryBuilder and InfiniteQueryController. Each gives you an InfiniteQueryController, which holds the pages in its value and loads more with fetchNextPage and fetchPreviousPage.

Classes

InfiniteData<TPageData, TPageParam>
The data an infinite query holds: every page fetched so far, and the param each was fetched with.
InfinitePageContext<TPageParam>
What a page function (InfiniteQueryOptions.pageFn) is handed: the param of the page to fetch, the direction, and the query's key, client, meta and cancellation token.
InfiniteQueryBuilder<TPageData, TPageParam, TData> Infinite queries
Builds its subtree from an infinite query, handing the builder the InfiniteQueryController so it can page.
InfiniteQueryController<TPageData, TPageParam, TData> Infinite queries
One infinite query, as a ValueListenable, with the paging operations and flags the sealed QueryResult does not carry.
InfiniteQueryObserverOptions<TPageData, TPageParam>
Observer options for a plain infinite query: no select, so the observer reports the InfiniteData the query holds, and two type arguments — the page and its param — name everything.
InfiniteQueryObserverOptionsBase<TPageData, TPageParam, TData>
InfiniteQueryOptions plus the observer-only options: select, placeholderData, the refetchOn* triggers, polling and retryOnMount.
InfiniteQueryOptions<TPageData, TPageParam>
Everything that describes an infinite query at the cache layer: a list whose pages are fetched one at a time, "load more" style.
InfiniteQuerySelectOptions<TPageData, TPageParam, TData>
Observer options for an infinite query whose observers see a projection of the pages: select is required and anchors TData.

Extensions

QueryContext on BuildContext Reading queries Mutations Infinite queries
Reads queries and mutations straight from a BuildContext, in build.

Typedefs

InfinitePageFn<TPageData, TPageParam> = FutureOr<TPageData> Function(InfinitePageContext<TPageParam> context)
Fetches one page, given the context that names its param — the page function of an infinite query (InfiniteQueryOptions.pageFn).
PageParamFn<TPageData, TPageParam> = TPageParam? Function(TPageData page, List<TPageData> pages, TPageParam pageParam, List<TPageParam> pageParams)
Where the next (or previous) page starts, or null when there is none.